{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "6882e778",
   "metadata": {},
   "source": [
    "# Chaotic Hyperion\n",
    "In this example, we simulate the spin of Hyperion. The spin evolution is governed by an ordinary differential equation that is coupled to the moon's orbit. \n",
    "\n",
    "We start by importing REBOUND, numpy and matplotlib."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "e350dbbb",
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "import rebound\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0bc568b2",
   "metadata": {},
   "source": [
    "The right hand side of ODEs can be implemented in either python or in C. Although not absolutely necessary for this example, we here show how to implement the RHS in C. This is often significantly faster than using a python callback function. \n",
    "\n",
    "We use a simple spin model which is one second order ODE, or a set of two coupled first order ODEs. For more details on the physics behind this model, see  Danby (1962), Goldreich and Peale (1966), and Wisdom and Peale (1983). The RHS of this set of ODEs implemented in C is:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "79a48333",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Overwriting rhs.c\n"
     ]
    }
   ],
   "source": [
    "%%writefile rhs.c\n",
    "#include \"rebound.h\"\n",
    "void derivatives(struct reb_ode* const ode, double* const yDot, const double* const y, const double t){\n",
    "    struct reb_orbit o = reb_orbit_from_particle(ode->r->G, ode->r->particles[1], ode->r->particles[0]);\n",
    "    \n",
    "    double omega2 = 3.*0.26; \n",
    "    yDot[0] = y[1];\n",
    "    yDot[1] = -omega2/(2.*o.d*o.d*o.d)*sin(2.*(y[0]-o.f));\n",
    "}\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "33cd1c9c",
   "metadata": {},
   "source": [
    "We now compile this into a shared library. We need the REBOUND headers and library for this. The following is a bit of hack: we just copy the files into the current folder. This works if you've installed REBOUND from the git repository. Otherwise, you'll need to find these files manually (which might depend on your python environment). "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "7d3c176a",
   "metadata": {},
   "outputs": [],
   "source": [
    "!cp ../src/librebound.so .\n",
    "!cp ../src/rebound.h .\n",
    "!gcc -c -O3 -fPIC rhs.c -o rhs.o\n",
    "!gcc -L. -shared rhs.o -o rhs.so -lrebound "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2421c0e7",
   "metadata": {},
   "source": [
    "Using ctypes, we can load the library into python"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "11736a91",
   "metadata": {},
   "outputs": [],
   "source": [
    "from ctypes import cdll\n",
    "clibrhs = cdll.LoadLibrary(\"rhs.so\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "37ac5371",
   "metadata": {},
   "source": [
    "The following function is setting up the N-body simulation as well as the ODE system that governs the spin evolution. Note that we set the `derivatives` function pointer to the C function we've just compiled. You could also set this function pointer to a python function and avoid all the C complications."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 133,
   "id": "18043d1d",
   "metadata": {},
   "outputs": [],
   "source": [
    "def setup():\n",
    "    sim = rebound.Simulation()\n",
    "    sim.add(m=1)             # Saturn\n",
    "    sim.add(a=1, e=0.123233) # Hyperion, massless, semi-major axis of 1\n",
    "    sim.integrator = \"BS\"\n",
    "    sim.ri_bs.eps_rel = 1e-12  # tolerance\n",
    "    sim.ri_bs.eps_abs = 1e-12\n",
    "    \n",
    "    ode_spin = sim.create_ode(length=2, needs_nbody=True)\n",
    "    ode_spin.y[0] = 0.01  # initial conditions that lead to chaos\n",
    "    ode_spin.y[1] = 1\n",
    "    ode_spin.derivatives = clibrhs.derivatives\n",
    "    \n",
    "    return sim, ode_spin"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "85c097cf",
   "metadata": {},
   "source": [
    "We will create two simulations that are slightly offset from each other."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8182b908",
   "metadata": {},
   "outputs": [],
   "source": [
    "sim, ode_spin = setup()\n",
    "sim2, ode_spin2 = setup()\n",
    "ode_spin2.y[0] += 1e-8 # small perturbation"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c597773f",
   "metadata": {},
   "source": [
    "With these two simulations, we can measure the growing divergence of nearby trajectories, a key feature of chaos."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 149,
   "id": "4eb25927",
   "metadata": {},
   "outputs": [],
   "source": [
    "times = 2.*np.pi*np.linspace(0,30,100) # a couple of orbits\n",
    "obliq = np.zeros((len(times)))\n",
    "obliq2 = obliq.copy()\n",
    "\n",
    "for i, t in enumerate(times):\n",
    "    sim.integrate(t, exact_finish_time=1)\n",
    "    sim2.integrate(t, exact_finish_time=1)        \n",
    "    obliq[i] = ode_spin.y[0]\n",
    "    obliq2[i] = ode_spin2.y[0]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "98a92abf",
   "metadata": {},
   "source": [
    "Finally, let us plot the divergence as a function of time."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 150,
   "id": "13ac8f3a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYoAAAEMCAYAAADal/HVAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/Z1A+gAAAACXBIWXMAAAsTAAALEwEAmpwYAAA2UElEQVR4nO3deXxU5dXA8d9JiBAXDChuEQStxVqtLBFUqkWqFVd4SYAAUjZBcMWdKgqoCIK+KBb1pewqi6yiolRFBEHZAlao4oJaiRYVCbJESMJ5/5gZmAwzd+5kZpKZzPl+PvmQubnLMwTumfuc5zmPqCrGGGNMKGlV3QBjjDGJzQKFMcYYRxYojDHGOLJAYYwxxpEFCmOMMY4sUBhjjHFkgcIYY4wjCxTGGGMc1ajqBoQjIu2Bq4HawERV/WfVtsgYY1JLlTxRiMgkEflBRDYGbG8rIptF5AsRGQSgqgtUtS/QH+hcFe01xphUVlVdT1OAtv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8g7fub2+McFYoDCpaCRwhvfT9mjvp/ONcPDT/ALv+gpfi8gtInKniKwXkQ9FpK53vzNE5E1v4cXlIhK2xo53/YYF3sJzH3onTPmePF4QkRXAC97d64vIUvGs9TDE7xy+aqEjgYu97+EOEfm9d22CDd7znxnDvy+T4hw/vRhTTQ0CzvF+2vZVEfV3Dp6qorWAL4D7VLWpiIwB/opn9v54oL+qfi4iLYFn8ZR3djIMWK+q7UWkDTANz2xggLPxFHMsFpGeeGoNnQPsBdaIyOuq6r8I1SDgblW9xvsengGeVtWXvCVo0iP4+zDGkQUKYw73rnetgl0ishN41bv9Y+AP3sqjFwGzPaWDAKjp4rx/BHIBVHWJiBwnIrW9P1uoqsV++76lqtsBRGSe91in1Qo/AB4QkVPxLFrzuYv2GOOKdT0Zczj/ujgH/F4fwPPhKg1Pzf8mfl+/i/KaewJeB9bWcay1o6rTgeuAYmCR94nFmJiwQGFS0S7gmIoe7F2/4CsR6QieiqQicp6LQ5cD3bzHtAZ+ClzXwc/l3pxGJp4VylYE/Lzce/AWgtuiqmPxVAv9g+s3ZEwYFihMyvF26awQkY0iMrqCp+kG9BGRj4BNuFs2dyjQXET+hScZ3cNh39V41kz4FzA3ID+Bd3uZiHwkInfgWfN5o3e1s3Pw5D+MiQmrHmtMnIjIUGC3qj5Rxe34GshR1Z+qsh0medkThTHxsxvoF+mEu1jxTbgDMji09oIxEbMnCmOMMY7sicIYY4wjCxTGGGMcWaAwxhjjyAKFMcYYRxYojDHGOPp/stT5eQpjkGUAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig, ax = plt.subplots(1,1)\n",
    "ax.set_xlabel(\"time [orbits]\")\n",
    "ax.set_ylabel(\"obliquity difference [degrees]\")\n",
    "ax.set_yscale(\"log\")\n",
    "ax.set_ylim([1e-8,1e2])\n",
    "o1 = np.remainder((obliq-obliq2)*180/np.pi,360.)\n",
    "o2 = np.remainder((obliq2-obliq)*180/np.pi,360.)\n",
    "ax.scatter(times/np.pi/2.,np.minimum(o1,o2))\n",
    "ax.plot(times/np.pi/2.,1e-8/np.pi*180.*np.exp(times/(np.pi*2.)/1.2),color=\"black\");"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c2bc381f",
   "metadata": {},
   "source": [
    "On a log-linear scale, we see that the divergence follows a straight line, indicating exponential growth. The Lyapunov timescale is approximately 1.2 orbits. About 25 days! (Wikipedia says ~30 days which is close enough given the very simplistic model)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
